import { } from 'react-native'
import { login } from '../../common/api/login'
import ACTIONKEY from '../key'

export function loginAction(phone, password, callback) {
  return dispatch => {
    const params = { phone, password }
    login(params).then(res => {
      dispatch({
        type: ACTIONKEY.USER_LOGIN,
        phone: res.data.phone
      })
      callback && callback(res)
    }).catch(error => {

    })
  }
}